<template>
  <a-modal :maskClosable="false"
    :title="title"
    :width="1480"
    :visible="visible"
    :confirmLoading="confirmLoading"
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭">
    <a-spin :spinning="confirmLoading">

      <a-table
        style="margin-top: 10px"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :scroll='{ x: 1300 }'
        @change="handleTableChange">
      </a-table>
    </a-spin>
  </a-modal>
</template>

<script>
import { httpAction, putAction, getAction, postAction } from '@api/manage'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { pushIfNotExist } from '@/utils/util'
import EmployeeDialog from '@views/his/dialog/EmployeeDialog'

export default {
  name: 'HHisInterviewPlanLogModal',
  mixins: [JeecgListMixin],
  components: {
    EmployeeDialog
  },
  data() {
    return {
      title: '操作',
      visible: false,
      disableMixinCreated: true,
      layout: {
        labelCol: { span: 6 },
        wrapperCol: { span: 14 }
      },
      confirmLoading: false,
      url: {
        list: '/ch/interview/log/list'
      },
      queryParam: {  },
      columns: [
        {
          title: '签到',
          align: 'left',
          dataIndex: 'signIn',
          width: 220,
          customRender: function (text, record, index) {

            if(record.planType=="1"){
              let textStr = '开始时间：' + record.signIn + '\n'
              textStr += '结束时间：' + record.signOut + '\n'
              textStr += '用时：' + record.duration + '\n'
              const answer = textStr.split('\n')
              return answer.map((item) => {
                return <li>{item}</li>
              })
            }
           return record.signIn;
          },
        },
        {
          title: '随访记录',
          align: 'center',
          dataIndex: 'recordContent'
        },
        {
          title: '精神状态',
          align: 'center',
          dataIndex: 'mentality',
        },
        {
          title: '运动情况(分钟/次)',
          align: 'center',
          dataIndex: 'sportsSituation',
          width: 130,
        },
        {
          title: '每周运动情况(次/周)',
          align: 'center',
          dataIndex: 'weekSportsSituation',
          width: 150,
        },
        {
          title: '摄盐情况',
          align: 'center',
          dataIndex: 'saltSituation',
          width: 80,
        },
        {
          title: '心理调整',
          align: 'center',
          dataIndex: 'psychologicalAdjust',
          width: 80,
        },
        {
          title: '遵医行为',
          align: 'center',
          dataIndex: 'complianceBehavior',
          width: 80,
        },
        {
          title: '服药依从性',
          align: 'center',
          dataIndex: 'medicationCompliance',
          width: 90,
        },
        {
          title: '此次随访分类',
          align: 'center',
          dataIndex: 'followUpSituation',
          width: 120,
        },
        {
          title: '指导意见',
          align: 'center',
          dataIndex: 'doctorGuidance',
        }
      ]
    }
  },

  created() {

  },
  methods: {
    view(record) {
      const that = this
      that.visible = true
      that.queryParam.planCode = record.planCode
      that.loadData()
    },
    close() {
      this.$emit('close')
      this.visible = false
    },
    handleOk() {
      const that = this
      that.close()
    },
    handleCancel() {
      this.close()
    }
  }
}
</script>

<style scoped>

</style>